package com.liuxu.NoRoot;

import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.Toast;

import java.io.IOException;

public class Read {
    private  AppInfo appinfo=new AppInfo();
    private int runtimes=15;
    private int wrongtimes=3;
    public void funnews(AccessService.Uiutil Finder) throws InterruptedException, IOException, NoSuchFieldException, IllegalAccessException {
        //不限文章
        String appname=appinfo.funnews[0];
        String packname=appinfo.funnews[1];
        String acitvity=appinfo.funnews[2];
        String allactivity=packname+"/"+acitvity;
        Log.v("包名",packname);
        Finder.OpenAPP(packname);
        Thread.sleep(5000);
        showtoast(appname+"开始运行");
        Finder.performBackClick();
        Finder.performScrollBackward();
        Finder.performScrollForward();
        Finder.clickTextViewByText("领取");
        Finder.performBackClick();
        Finder.clickTextViewByText("任务");
        Finder.clickTextViewByText("头条");
        Finder.clickTextViewByID("com.jifen.qukan:id/yk");
        Thread.sleep(5000);
        Finder.performScrollForward();
        Thread.sleep(2000);

    }

    public void showtoast(final String text){
        Handler handlerThree=new Handler(
                Looper.getMainLooper());
        handlerThree.post(new Runnable(){
            public void run(){
                Toast.makeText(MyApplication.getContext(),text, Toast.LENGTH_LONG).show();
            }
        });//
    }
}
